package com.xzw.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class AppjdbcInsert {
    public static void main(String[] args)throws Exception {
        //加载驱动类
        Class.forName("com.mysql.jdbc.Driver");
        //获取连接
        String url=("jdbc:mysql://localhost:3306/xzw?useSSL=false");
        String username="root";
        String password="root";
        Connection connection = DriverManager.getConnection(url, username, password);

        Statement statement = connection.createStatement();
        String sql = "insert into `user`(`username`,`password`) values('杨戬',MD5('789'))";
        int i = statement.executeUpdate(sql);
        if(i>0)
            System.out.println("输入成功！");
    }

}
